Explore NKTECH Industries' innovative research in electronics, focusing on advanced automotive safety and security solutions.
Authors: Muhammad Abdur Rehman, Amina Asif, Muhammad Shahbaz, Ahsan Ayaz
Affiliation: Department of Electrical and Computer Engineering, Air University, Islamabad 14220, Pakistan
Date: June 2025
Download Full Report (PDF)In today’s rapidly evolving technological landscape, integrating advanced sensor technologies is crucial for enhancing vehicle safety and security. The Automobile Accident and Theft Prevention System addresses this by incorporating drowsiness detection, alcohol and CO detection, battery theft detection, and tire theft sensors, all interfaced with a microcontroller. The system proactively mitigates accident risks by detecting driver impairments and environmental hazards, triggering actions such as rolling down windows for ventilation. Additionally, it enables real-time theft detection, notifying authorities of unauthorized component removal via GSM/GPS modules. This affordable, energy-efficient solution is compatible with any vehicle and operates independently of the car’s battery, ensuring continuous monitoring even when the vehicle is off.
Figure 1: Block diagram of the Automobile Accident and Theft Prevention System, illustrating sensor and microcontroller integration.
The Automobile Accident and Theft Prevention System integrates advanced sensor technologies with a microcontroller to address the persistent threats of vehicle accidents and thefts. By proactively detecting hazards such as driver drowsiness, alcohol or CO levels, and unauthorized component removal, the system enhances road safety and security. It leverages GSM/GPS modules for real-time alerts and location tracking, operating independently of the vehicle’s battery. Recent studies [1–4] highlight the effectiveness of integrated sensor systems in reducing response times and improving recovery outcomes. This cost-effective, self-sustaining solution is compatible with any vehicle, making it suitable for both urban and rural environments.
Advancements in vehicle safety and security emphasize real-time monitoring through sensor integration. Kumar et al. [1] highlight low-cost embedded systems, while Rao and Kumar [2] demonstrate Arduino-based accident detection. Hossain and Hassan [3] focus on cost-efficient GPS/GSM tracking, and Jain and Sharma [4] review integrated theft and accident alert systems. Additional studies [5–11] explore smart vehicle systems, air pollution monitoring, and tracking solutions. However, many existing systems are limited to single functions, are expensive, or rely on the vehicle’s battery, reducing accessibility for middle-class consumers. These systems often lack user-friendly interfaces, complicating installation and maintenance. This project proposes an affordable, all-in-one solution that combines accident prevention and theft detection, operating independently and efficiently.
Despite advancements in automotive technology, vehicle accidents and thefts remain significant threats to public safety and security. Current systems often fail to address both accident prevention and theft detection comprehensively, leading to false alarms, vulnerabilities, and delayed responses. The increasing frequency of thefts and accidents highlights the need for an integrated solution with advanced sensors, real-time monitoring, and intuitive interfaces. This system aims to minimize false alarms, reduce response times, and provide robust protection, especially when the vehicle is off or the battery is removed.
The system was developed using a user-centered approach, involving surveys, interviews, and observations with drivers, fleet operators, and car owners to identify safety and security needs. A literature review informed the selection of cost-effective, reliable components for drowsiness detection, alcohol/CO detection, tire pressure monitoring, battery theft, and tire theft. The system architecture integrates these sensors with a microcontroller, with software algorithms managing data and alerts. A prototype was built, tested for accuracy and reliability, and refined based on feedback from drivers and experts to meet safety standards.
The system employs a dual-microcontroller setup with an Arduino Mega 2560 as the primary controller and an Arduino Nano as a sensor node, communicating via serial protocols. Sensors include drowsiness, alcohol/CO, tire pressure, and theft detection modules, interfaced with SIM900A GSM and Neo-6M GPS modules for alerts and tracking. A BTS7960 H-Bridge drives power windows for ventilation.
Components were tested for accuracy, responsiveness, and compatibility to ensure reliable operation across various conditions.
The prototype integrates hardware and software, with iterative testing and feedback-driven refinements to enhance functionality and usability.
Figure 2: Software simulation of the system’s sensor data processing and alert mechanisms.
The system uses a dual-microcontroller architecture with an Arduino Mega 2560 as the main controller and an Arduino Nano as a dedicated sensor node, improving performance, hardware distribution, and maintenance. The Mega, powered via USB, oversees core activities, interfacing with SIM900A GSM and Neo-6M GPS modules for alerts and tracking, and a BTS7960 H-Bridge for power window control. The Nano, powered by a USB power bank, handles sensor data (crash, gas, battery/tire theft), preventing overcurrent issues. A common ground ensures stable analog readings and communication. The system operates independently of the vehicle’s battery, ensuring functionality when the car is off.
Figure 3: Overview of the Automobile Accident and Theft Prevention System.
Calculations for the BTS7960 H-Bridge ensure sufficient current and voltage for power window operation, optimized for energy efficiency.
Figure 4: Calculations for power window control using BTS7960 H-Bridge.
Gas sensor calibration ensures accurate detection of CO and alcohol levels, triggering ventilation when thresholds are exceeded.
Figure 5: Gas sensor calibration calculations .
Figure 6: Results of gas sensor detection tests.
Testing across various vehicles under real-world conditions confirmed the system’s reliability. Battery theft triggered immediate alarms and user notifications via calls. Crash detection sent SMS alerts with GPS coordinates, accompanied by an alarm. Gas detection activated window ventilation upon detecting harmful gases, and tire theft sensors accurately detected removal, sending warning messages. The system’s independence from the vehicle’s battery ensured functionality when off. Limitations include weak network coverage affecting alerts, lack of a user-friendly interface, power bank charging requirements, and sensor vulnerability in harsh environments. Future improvements include enhanced network resilience, improved interfaces, and protective sensor housing.
Figure 7: Demonstration of crash detection and battery theft alerts.
The Automobile Accident and Theft Prevention System represents a significant advancement in vehicle safety and security. By integrating sensors for drowsiness, alcohol/CO, crash, battery, and tire theft detection, it addresses critical challenges such as driver fatigue, gas poisoning, accidents, and component theft. Successful implementation in a real vehicle demonstrates its potential as a reliable, cost-effective solution. This project contributes to automotive safety, serves as a learning experience in applying engineering principles, and lays the foundation for future development and commercialization of advanced safety and security systems.
Conceptualization, M.A.; methodology, A.A, M.A and M.S; software, M.A; validation, A.S, M.A and A.A; formal analysis, A.S; investigation, M.S; resources, A.A, M.A and M.N; data curation, M.S, A.A, M.A and A.S; writing original draft preparation, M.A.; writing review and editing, M.A and A.A; visualization, M.S, A.A, M.A and M.S; supervision, A.A; project administration, A.A; funding acquisition, M.A, A.A and M.S. All authors have read and agreed to the published version of the manuscript.
This research received no external funding.
This research received no external funding.
Not applicable.
The data presented in this study are available on request from the corresponding author, M.A. The data are not publicly available due to restrictions e.g. their containing information that could compromise the privacy of research participants.
The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the result
The following Arduino code outlines the system’s functionality for crash, gas, and theft detection. Replace with actual code if available.
<>MQ7 CO Detection Module:
define MQPin A2 define motorPin1 8 define motorPin2 7 define enablePin 9 bool windowIsDown = false; unsigned long motorStartTime; bool motorRunning = false; bool lastGasValue = LOW; void setup() Serial.begin(9600); pinMode(enablePin, OUTPUT); pinMode(motorPin1, OUTPUT); pinMode(motorPin2, OUTPUT); digitalWrite(motorPin1, LOW); digitalWrite(motorPin2, LOW); analogWrite(enablePin, 0); void loop() int gasValue = digitalRead(MQPin); Serial.print(”Gas Value: ”); Serial.println(gasValue); if (gasValue == HIGH && lastGasValue == LOW && !motorRunning && !windowIsDown) Serial.println(”Gas detected! Lowering window...”); digitalWrite(motorPin1, HIGH); digitalWrite(motorPin2, LOW); analogWrite(enablePin, 255); motorStartTime = millis(); motorRunning = true; lastGasValue = HIGH; else if (gasValue == LOW && lastGasValue == HIGH && !motorRunning && windowIsDown) Serial.println(”No gas detected! Raising window...”); digitalWrite(motorPin1, LOW); digitalWrite(motorPin2, HIGH); analogWrite(enablePin, 255); motorStartTime = millis(); motorRunning = true; lastGasValue = LOW; if (motorRunning && (millis() - motorStartTime ¿= 3000)) analogWrite(enablePin, 0); digitalWrite(motorPin1, LOW); digitalWrite(motorPin2, LOW); windowIsDown = lastGasValue == HIGH; motorRunning = false; Serial.println(”Motor stopped.”); delay(100);Drowsiness Glasses:
const int irSensorPin = 5; const int buzzerPin = 6; void setup() pinMode(irSensorPin, INPUT); pinMode(buzzerPin, OUTPUT); digitalWrite(buzzerPin, LOW); void loop() int sensorState = digitalRead(irSensorPin); if (sensorState == HIGH) digitalWrite(buzzerPin, HIGH); else digitalWrite(buzzerPin, LOW); delay(100);Theft System:
include ¡SoftwareSerial.h¿ SoftwareSerial gsm(10, 11); const int fsrPin = A1; const int threshold = 100; bool callMade = false; void setup() Serial.begin(9600); gsm.begin(9600); delay(1000); Serial.println(”Setup complete. Monitoring FSR values...”); void loop() int fsrValue = analogRead(fsrPin); Serial.print(”FSR Value: ”); Serial.println(fsrValue); if (fsrValue ¡ threshold && !callMade) makeCall(”+923171141678”); Serial.println(”Your battery is stolen!”); callMade = true; else if (fsrValue ¿= threshold && callMade) callMade = false; delay(100); makeCall(const char* phoneNumber) gsm.print(”ATD”); gsm.print (phoneNumber); gsm.println(”;”); delay(1000);Sensor:
Serial.println(”Calling...”); const int mq2Pin = A0; const int buzzerPin = 6; const int gasThreshold = 300; void setup() pinMode(mq2Pin, INPUT); pinMode(buzzerPin, OUTPUT); digitalWrite(buzzerPin, LOW); Serial.begin(9600); void loop() int gasValue = analogRead(mq2Pin); Serial.print(”Gas Value: ”); Serial.println(gasValue); if (gasValue ¿ gasThreshold) digitalWrite(buzzerPin, HIGH); else digitalWrite(buzzerPin, LOW); delay(100);I2C Slave Code:
#include ¡Wire.h¿ define MQ2P INA2 def ineIRP INA3 def ineCRASHP INA1 def ineT HEF TP INA0 uint8tsensorData[8]; booldataRequested = f alse; void setup() Wire.begin(0x08); // Use address 0x08 Wire.onRequest(requestEvent); Serial.begin(115200); Serial.println(”Nano Slave Ready”); void loop() updateSensorData(); if(dataRequested) Serial.println(”Data was requested since last update”); dataRequested = false; delay(50); void updateSensorData() uint16tmq2V alue = analogRead(MQ2P IN); uint16tirV alue = analogRead(IRP IN); uint16tcrashV alue = analogRead(CRASHP IN); uint16tthef tV alue = analogRead(T HEF TP IN); sensorData[0] = mq2Value » 8; sensorData[1] = mq2Value 0xFF; sensorData[2] = irValue » 8; sensorData[3] = irValue 0xFF; sensorData[4] = crashValue » 8; sensorData[5] = crashValue 0xFF; sensorData[6] = theftValue » 8; sensorData[7] = theftValue 0xFF; Serial.print(”Current Values: ”); Serial.print(mq2Value); Serial.print(”, ”); Serial.print(irValue); Serial.print(”, ”); Serial.print(crashValue); Serial.print(”, ”); Serial.println(theftValue); void requestEvent() dataRequested = true; Wire.write(sensorData, 8); Serial.println(”Sent 8 bytes”); // Master Code // === Final Year Project: Full Integrated System === // Crash + Battery Theft + Tyre Theft + Smoke Detection + GSM + GPS + Window Lowering + SMS Control include ¡Wire.h¿ define GPS Serial1 define GSM Serial2 define BUZZERP IN7 def ineREN2 def ineLEN3 def ineRPWM5 def ineLPWM6 define SLAVEADDR0x08 bool crashDetected = false; bool theftDetected = false; bool tyreAlerted = false; bool coAlerted = false; bool ignoreSensors = false; unsigned long ignoreUntil = 0; void setup() Wire.begin(); Serial.begin(9600); GPS.begin(9600); GSM.begin(9600); pinMode(BUZZERP IN, OUT P UT); digitalW rite(BUZZERP IN, LOW); pinMode(REN, OUT P UT); digitalW rite(REN, HIGH); pinMode(LEN, OUT P UT); digitalW rite(LEN, HIGH); pinMode(RPWM, OUT P UT); analogW rite(RPWM, 0); pinMode(LPWM, OUT P UT); analogW rite(LPWM, 0); GSM.println(”AT+CMGF=1”); delay(1000); GSM.println(”AT+CNMI=1,2,0,0,0”); delay(1000); Serial.println(”System Initialized ”); void loop() checkIncomingSMS(); if (ignoreSensors millis() ¡ ignoreUntil) Serial.println(” Ignoring events after RESET...”); delay(500); return; uint8tdata[8]; W ire.requestF rom(SLAV EADDR, 8); for(inti = 0; i < 8W ire.available(); i + +)data[i] = W ire.read(); uint16tmq2 = (data[0] << 8)|data[1]; uint16tir = (data[2] << 8)|data[3]; uint16tcrash = (data[4] << 8)|data[5]; uint16tthef t = (data[6] << 8)|data[7]; Serial.print(”MQ2: ”); Serial.print(mq2); Serial.print(” — IR: ”); Serial.print(ir); Serial.print(” — Crash FSR: ”); Serial.print(crash); Serial.print(” — Theft FSR: ”); Serial.println(theft); // Crash Detection if (crash ¿ 700 !crashDetected) String location = getGPSLocation(); Serial.println(” Crash Detected!”); digitalWrite(BUZZERP IN, HIGH); sendSMS(”CrashDetected! : ”, location); crashDetected = true; // Battery Theft Detection if (theft ¡ 50 !theftDetected) Serial.println(” Battery Theft Detected!”); digitalWrite(BUZZERP IN, HIGH); makeCall(); thef tDetected = true; //T yreT hef t if(ir > 500!tyreAlerted)Stringlocation = getGP SLocation(); Serial.println(”T yreStolen!”); sendSMS(”//SmokeDetection if(mq2 > 300!coAlerted)Stringlocation = getGP SLocation(); Serial.println(”SmokeDetected!Loweringwdelay(1000); // === GSM GPS === void sendSMS(String msg, String location) GSM.println(”AT+CMGS=+923171141678 ¨ ¨”); delay(1000); GSM.print(msg); if (location != ”Location not found”) GSM.print(”https://www.google.com/maps/place/”); GSM.print(location); else GSM.print(”Location not available”); GSM.write(26); Serial.println(” SMS Sent!”); void makeCall() GSM.println(”ATD+923171141678;”); delay(10000); GSM.println(”ATH”); Serial.println(” Call Made!”); void checkIncomingSMS() if (GSM.available()) String sms = GSM.readString(); sms.toUpperCase(); Serial.println(”Received SMS: ” + sms); if (sms.indexOf(”STOP”) ¿= 0) digitalWrite(BUZZERP IN, LOW); Serial.println(”BuzzerturnedOF F bySMS!”); if(sms.indexOf(”RESET”) >= 0)crashDetected = f alse;thef tDetected = f alse;tyreAlerted = f alse; StringgetGP SLocation()StringgpsSentence = ””; Stringlatitude = ””; Stringlongitude = ””; unsignedloint latStart = nthIndexOf(gpsSentence, ’,’, 2); int latEnd = nthIndexOf(gpsSentence, ’,’, 3); int lonStart = nthIndexOf(gpsSentence, ’,’, 4); int lonEnd = nthIndexOf(gpsSentence, ’,’, 5); String rawLat = gpsSentence.substring(latStart + 1, latEnd); String rawLon = gpsSentence.substring(lonStart + 1, lonEnd); if (rawLat.length() ¿ 0 rawLon.length() ¿ 0) float lat = convertLat(rawLat); float lon = convertLon(rawLon); if (lat != 0.0 lon != 0.0) return String(lat, 6) + ”,” + String(lon, 6); gpsSentence = ””; return ”Location not found”; int nthIndexOf(String str, char ch, int n) int pos = -1; while (n– ¿ 0) pos = str.indexOf(ch, pos + 1); if (pos == -1) break; return pos; float convertLat(String raw) if (raw.length() ¡ 6) return 0.0; float degrees = raw.substring(0, 2).toFloat(); float minutes = raw.substring(2).toFloat(); return degrees + (minutes / 60.0); float convertLon(String raw) if (raw.length() ¡ 6) return 0.0; float degrees = raw.substring(0, 3).toFloat(); float minutes = raw.substring(3).toFloat(); return degrees + (minutes / 60.0);
A full demonstration of the project is available, showcasing live testing of crash detection, tire theft alerts, gas response, and battery theft simulation under real-world conditions.